<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<title>Strategic Businessgame</title>
	<meta http-equiv="Content-Type"
		content="application/xhtml+xml; charset=utf-8" />
	<meta name="description" content="Businessgame" />
	<meta name="keywords" content="TUWien Strategic Management Game" />
	<meta name="language" content="de-AT" />

	<!--  CSS includes by JSF EL-->
	<h:outputStylesheet library="css" name="planspiel.css" target="head" />
	<h:outputStylesheet library="css" name="fonts.css" target="head" />
	<h:outputStylesheet library="css" name="skinning.css" target="head" />
	<h:outputStylesheet library="css" name="core.css" target="head" />
	
	
</h:head>
<h:body>
<f:view locale="en">
<p:layout id="mainLayout" fullPage="true">
	<p:layoutUnit id="northLayoutUnit" position="north" styleClass="noScrolllayoutUnit">
		<h:form id="toolbar">
			<p:toolbar id="navigation">
				<p:toolbarGroup align="left">

				<h:link outcome="#{userMBean.actionGotoUserMainPage()}"
					rendered="#{not empty userMBean.user}">
					<h:graphicImage name="business_logo.png" library="img" width="150"
						height="35" />
				</h:link>
				
				<p:idleMonitor timeout="1800000" rendered="#{not userMBean.admin and not empty userMBean.user}">
				    <p:ajax event="idle" listener="#{loginMBean.timeout()}" oncomplete="alert('Session expired! Please login again!')"/>
				</p:idleMonitor>
				
				</p:toolbarGroup>
				
				
				<p:toolbarGroup align="right">
					<p:outputPanel styleClass="loginPanel" id="loginPanel"
						rendered="#{empty userMBean.user}">
						<p:outputPanel styleClass="groupedInput">
<!-- 							<p:outputLabel for="nickname" value="Username" /> -->
							<p:watermark for="nickname" value="Username..." /> 
							<p:inputText id="nickname" value="#{loginMBean.nickname}"
								label="nickname" maxlength="20">
							</p:inputText>
						</p:outputPanel>
						<p:outputPanel styleClass="groupedInput">
<!-- 							<p:outputLabel for="password" value="Password" /> -->
							<p:watermark for="password" value="Password..." /> 
							<p:password id="password" value="#{loginMBean.password}"
								label="Password" maxlength="50" />
						</p:outputPanel>
						<p:commandButton id="submit" update="loginPanel"
							value="Login" action="#{loginMBean.submit}" />
					</p:outputPanel>

					<p:outputPanel id="userMenu" rendered="#{not empty userMBean.user}">
						
						<ui:insert id="siteTitle" name="siteTitle">
	    				</ui:insert>
	    				<p:spacer width="50" height="10" />
						<h:outputText value="#{userMBean.roundInformation}"/>
						<p:spacer width="50" height="10" />
						<!-- 
						<p:commandButton action="search?faces-redirect=true" value="Suche"
							icon="ui-icon-search" />  -->
						<!--  <p:commandButton action=""
							value="Sotivity anlegen" icon="ui-icon-plusthick" />  -->	
						
							
						<p:menuButton id="menuButton" value="#{userMBean.user.nickname}">
							
							<p:menuitem value="Main Site"
								action="#{userMBean.actionGotoUserMainPage()}"  icon="ui-icon-home"/>
								
							<p:menuitem value="Game Management" rendered="#{userMBean.admin}" icon="ui-icon-gear"
								action="adminGameManagement?faces-redirect=true" />
								
							<p:menuitem value="Product Management" rendered="#{userMBean.admin}" icon="ui-icon-gear"
								action="adminProductManagement?faces-redirect=true" />	
								
							<p:menuitem value="Supplier Management" rendered="#{userMBean.admin}" icon="ui-icon-gear"
								action="adminSupplierManagement?faces-redirect=true" />	
							
							<p:menuitem value="Game Statistics" rendered="#{userMBean.admin}" icon="ui-icon-image"
								action="adminGameStatisticsManagement?faces-redirect=true" />	
								
							<p:menuitem value="Company Overview" rendered="#{not userMBean.admin}" icon="ui-icon-image"
								action="companyOverview?faces-redirect=true" />
								
							<p:menuitem value="Decisions" rendered="#{not userMBean.admin}" icon="ui-icon-pencil"
								action="#{companyMBean.navigateToCompanyDecisions()}" />	
								
							<p:menuitem value="Previous decisions" rendered="#{not userMBean.admin}" icon="ui-icon-image"
								action="#{reportMBean.navigateToOwnDecisions()}" />
								
							<p:menuitem value="Reports" rendered="#{not userMBean.admin}" icon="ui-icon-image"
								action="companyReports?faces-redirect=true" />	
							<!--  	
							<p:menuitem value="Firm Statistic (Testing)" rendered="#{userMBean.admin}" icon="ui-icon-image"
								action="adminFirmCharting?faces-redirect=true" />	
							-->			
							<p:menuitem value="Own settings" icon="ui-icon-gear"
								action="userSettings?faces-redirect=true" />
								
							<p:menuitem value="Game settings" icon="ui-icon-gear" rendered="#{userMBean.admin}"
								action="adminGameSettings?faces-redirect=true" />
							
							<p:menuitem value="Log Out" action="#{userMBean.logout}" icon="ui-icon-power"
								update="loginPanel, userMenu" />
							
							
						</p:menuButton>
					</p:outputPanel>

				</p:toolbarGroup>
			</p:toolbar>
			<ui:insert id="compDecTB" name="compDecTB">
	    	</ui:insert>
		</h:form>
	</p:layoutUnit>
	
	<p:layoutUnit id="westLayoutUnit" position="west" size="50"/>
	
	<p:layoutUnit id="centerLayoutUnit" position="center">
		<p:messages id="messages" showDetail="false" autoUpdate="true"
			closable="true">
			<p:effect type="fade" event="load" delay="5000"/>
		</p:messages>
		
		<ui:insert id="uiInsertContent" name="content">
	    	My content
	    </ui:insert>
    </p:layoutUnit>
    
</p:layout>
</f:view>
</h:body>
</html>
